home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950528-19950726 / 000095_news@columbia.edu_Fri Jun 9 15:35:39 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA14738
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Fri, 9 Jun 1995 11:35:50 -0400
  3. Received: by apakabar.cc.columbia.edu id AA24432
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Fri, 9 Jun 1995 11:35:49 -0400
  5. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  6. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: Re: String manipulations
  9. Date: 9 Jun 1995 15:35:39 GMT
  10. Organization: Columbia University, New York City
  11. Lines: 31
  12. Message-Id: <3r9pob$nr8@apakabar.cc.columbia.edu>
  13. References: <3r7lcl$956@feenix.metronet.com>
  14. Nntp-Posting-Host: watsun.cc.columbia.edu
  15. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  16.  
  17. In article <3r7lcl$956@feenix.metronet.com>,
  18. Brit Systems <brit@metronet.com> wrote:
  19. >What calls are there to parse a string?
  20. >Like I need to get the filename out of a fully qualified filename.
  21. >
  22. >getfilename C:/SOME/DUMB.FIL
  23. >will provide DUMB.FIL
  24. >
  25. >It's gotta be easy, but I can't find it.
  26. >
  27. When posting questions like this to (as Pnews would say) "the entire
  28. civilized world", it's always a good idea to make your posting as
  29. useful as possible -- in this case by specifying which software and
  30. version you are talking about.  Let's assume you are using MS-DOS
  31. Kermit 3.14 (not earlier) or C-Kermit 5A(190).  In that case, the
  32. answer is yes.  Read about the string functions in the KERMIT.UPD
  33. file that comes on the MS-DOS Kermit 3.14 diskette, or in the book
  34. "Using C-Kermit".
  35.  
  36. Here, for example, is a (perhaps not totally straightforward) trick for
  37. getting the "basename" from a DOS file specification, which is in the 
  38. variable \%f:
  39.  
  40.   asg \%f \\\%f                ; Prepend a backslash
  41.   asg \%9 \freverse(\%f)       ; Reverse the string
  42.   asg \%8 \findex(\,\%9,1)     ; Find first backslash
  43.   decrement \%8                ; Length of string before backslash
  44.   asg \%9 \fsubstr(\%9,1,\%8)  ; Extract it
  45.   asg \%9 \freverse(\%9)       ; Unreverse it
  46.  
  47. - Frank